<template>
  <div class="page bgc-fff">
    <!-- header -->
    <div class="header">
      <ul class="lisa-list bor-bottom pad-t30">
        <li class="lisa-list-body 20">
          <a href="javascript:void(0)" class="lisa-list-item" @click="toCompanyInfo()">
            <div class="lisa-list-content">
              <div class="header-head mr10">
                <img :src="userInfoData.userPic"  alt="">
              </div>
              <div class="lisa-list-text">
                <div class="lisa-list-title">
                  <span class="mr10 f14 c-fff">{{userKey}}</span><span class="f14 c-ffaa09">{{text1}}</span>
                </div>
                <div class="lisa-list-brief c-fff">
                  {{text2}}
                </div>
              </div>
            </div>
            <!-- <img class="icon-btn-right" :src="staticImgData.imgurlb" alt=""> -->
          </a>
        </li>
      </ul>
    </div>
    <!-- content -->
    <div class="content">
      <div class="content-item bor-bottom" @click="toCarInfo">
        <div class="flex a-start l-center">
          <!-- <i class="icon"></i> -->
          <p>车辆信息</p>
        </div>
        <div class="flex a-end l-center ">
          <span class="mr10 f14 c-01a4f6" v-if="!vehicleInfoStatus">{{text3}}</span>
          <img class="icon-btn-right" :src="staticImgData.imgurlb" alt="">
        </div>
      </div>
      <div class="content-item bor-bottom" @click="toFleetInfo">
        <div class="flex a-start l-center">
          <!-- <i class="icon"></i> -->
          <p>车队信息</p>
        </div>
        <img :src="staticImgData.imgurlb" alt="">
      </div>
      <div class="content-item bor-bottom" @click="toDirverInfo">
        <div class="flex a-start l-center">
          <!-- <i class="icon"></i> -->
          <p>司机信息</p>
        </div>
        <img :src="staticImgData.imgurlb" alt="">
      </div>
      <div class="content-item bor-bottom" @click="toModifyPwd">
        <div class="flex a-start l-center">
          <!-- <i class="icon"></i> -->
          <p>密码修改</p>
        </div>
        <img :src="staticImgData.imgurlb" alt="">
      </div>
      <!-- <div class="mo-spacing"></div> -->
    </div>
    <!-- button -->
    <div class="loginout-btn">
      <div class="pad-l-r15 ">
        <p class="large-btn bor-1-DEDEDE c-333" @click="toLoginOut">退出登录</p>
      </div>
    </div>
    <!-- <div style="height:.5rem;"></div> -->
    <v-tabbar></v-tabbar>
    <v-loading v-show="loadingShow"></v-loading>
  </div>
</template>

<script type="text/ecmascript-6">
import LisaTabbar from '@/components/common/tabbar/tabbar'
import Loading from '@/components/common/loading/loading'
import * as ThreeStorage from '@/utils/store/token.js' // cookie local session 统一管理
import * as TenantApi from '@/api/tenant'
export default {
  name: 'me-adminLanding',
  data() {
    return {
      navName: '', // footer_nav 传选中nav的name
      userKey: '', // 用户登陆号（邮箱/手机号）
      staticImgData: {
        imgurla: require('@/assets/image/v1/user/edit.png'),
        imgurlb: require('@/assets/image/common/btn_right.png')
      },
      userInfoData: {
        userPic: require('@/assets/image/common/user.png'),
        weixinName: '用户'
      },
      companyInfoData: {
        authStatus: '', //  认证状态：0-未认证;1-已认证
        businessSite: '', // 业务覆盖城市，取城市。多个用分号分割
        code: '', //
        createFrom: '', // 数据来源 微信公众 or pc
        creator: '', // 创建人
        gmtCreate: '', // 注册时间
        gmtUpdate: '', //
        id: '', //
        isDelete: '', //
        legalRep: '', // 法人姓名
        name: '', // 全称
        nameAbbr: '', // 简称
        registryCapital: '', // 注册资本
        registrySite: '', // 注册地址
        remark: '', // 备注
        repMobile: '', // 法人电话
        serviceType: '', // 服务类型（多个用分号隔开）
        status: '', // 业务状态：0-停用;1-启用
        tenantId: '', //
        workingSite: '' // 办公地点
      },
      driverInfoStatus: false,
      vehicleInfoStatus: false,
      loadingShow: false,
      text1: '',
      text2: '',
      text3: '',
      text4: '',
      text5: ''
    }
  },
  components: {
    'v-loading': Loading,
    'v-tabbar': LisaTabbar
  },
  created() {
    this.userKey = ThreeStorage.getUserkey() || '用户'
    this.getAccountInfoFunc()
  },
  methods: {
    getAccountInfoFunc: function() {
      this.loadingShow = true
      TenantApi.getLspByTeantId().then(res => {
        this.loadingShow = false
        if (res.code === 0) {
          const res_data = res.data
          this.companyInfoData = res.data
          if (res_data.name) {
            this.text2 = res_data.name
          } else {
            this.text2 = '用户'
          }
          if (res_data.authStatus === 1) {
            this.text1 = '已认证'
          } else {
            this.text1 = '未认证'
          }
        }
      }).catch(res => {
        this.loadingShow = false
        console.warn('error', res)
      })
    },
    toCarInfo: function() {
      this.$router.push({ name: 'me-adminVehicleList' })
    },
    toFleetInfo: function() {
      this.$router.push({ name: 'me-adminFleetList' })
    },
    toDirverInfo: function() {
      this.$router.push({ name: 'me-adminDriverList' })
    },
    toModifyPwd: function() {
      this.$router.push({ name: 'me-updatePassword' })
    },
    toCompanyInfo: function() {
      this.$router.push({ name: 'me-adminCompanyProfile' })
    },
    toLoginOut: function() {
      console.log('进行登出')
      this.$store.dispatch('FedLogOut')
    }
  }
}
</script>

<style scoped>
@import '../../styles/util.css';
@import '../../styles/basic/list.css';
.c-00BFFF{
  color:  #00BFFF;
}
.block-border{
  border-radius: .04rem;
  /* border: 1px  solid #dedede ; */
  padding: .02rem;
  /* margin-right: .05rem; */
}
.main-item>img {
  width: .4rem;
  height: .4rem;
  margin-right: .15rem;
}
.large-btn.c-333{
  color: #000;
}
/* header */
.header{
  background: url('../../assets/image/v1/user/header_bg.png') no-repeat center top;
  background-size: 100%;
  position: relative;
}
.header-head{
  width: .56rem;
  height: .56rem;
  /* margin-left: auto;
  margin-right: auto; */
  border-radius:1rem;
  overflow: hidden;
}
.header-head>img{
  width: .56rem;
  height: .56rem;
}
/* content */
.content{
  background-color: #fff;
  padding-top: .37rem;
  font-size: .16rem;
  color: #000;
}
.content-item{
  padding-left: .15rem;
  padding-right: .15rem;
  padding-top: .15rem;
  padding-bottom: .15rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.content-item>img{
  width: .06rem;
  height: .1rem;
  margin-right: .03rem;
}
.mo-spacing{
  background-color: #f4f4f4;
}
.text-box2{
  flex-grow: 1;
  height: .2rem;
  line-height: .2rem;
  vertical-align: bottom;
}
.text-box3{
  flex-grow:4;
  height: .2rem;
  line-height: .2rem;
  vertical-align: bottom;
}
.opacity-hide{
  opacity: 0;
}
/* 退出登录 */
.loginout-btn{
  position: absolute;
  width: 100%;
  top:78%;
  z-index: 9;
}
</style>

